<%--
  Created by IntelliJ IDEA.
  User: dqf
  Date: 2015/3/2
  Time: 15:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<section id="widget-grid" class="">
    <!-- row -->
    <div class="row">
        <!-- NEW WIDGET START -->
        <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <!-- Widget ID (each widget will need unique ID)-->
            <div class="jarviswidget " id="wid-id-0" data-widget-editbutton="false"
                 data-widget-colorbutton="false"
                 data-widget-togglebutton="false"
                 data-widget-deletebutton="false"
                 data-widget-fullscreenbutton="true"
                 data-widget-custombutton="false"
                 data-widget-sortable="false">

                <!-- widget div-->
                <div>
                    <input type="hidden" name="proInfoId" id="proInfoId" value="<s:property value="proInfoId" />"/>
                    <!-- widget content -->
                    <div class="widget-body no-padding">
                        <div class="col-sm-12 col-md-12 col-lg-12">
                            <div class=" ">

                                <div class="row" id="ajax_proback_list_row">
                                    <table id="ajax_proback_table" class="table table-striped table-bordered table-hover">
                                    </table>
                                    <div id="ajax_proback_list_page">
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                    <!-- end widget content -->

                </div>
                <!-- end widget div -->
            </div>
            <!-- end widget -->
        </article>
        <!-- WIDGET END -->
    </div>
    <!-- end row -->
</section>

<script type="text/javascript">
    // DO NOT REMOVE : GLOBAL FUNCTIONS!
    pageSetUp();

</script>
<script type="text/javascript">
    $(function(){
        load_proback_jqGrid();
    });
    function load_proback_jqGrid(){
        jQuery("#ajax_proback_table").jqGrid({
            url:'ajax-pro-back!tablist.action?proInfoId='+$("#proInfoId").val(),
            datatype: "json",
            colNames:['项目名称',"反馈日期",'反馈类别',"反馈内容","反馈人","是否正常","通知人员","操作","id"],
            colModel:[
                {name:'proname',index:'proname', width:120,sortable:true},
                {name:'backDate',index:'backDate', width:80},
                {name:'category',index:'category', width:80},
                {name:'content',index:'content', width:180},
                {name:'creater',index:'creater', width:80},
                {name:'regular',index:'regular', width:80,formatter:regularFormat},
                {name:'notice',index:'notice', width:180},
                {name:'act',index:'act', width:150,sortable:false,fixed:true},
                {name:'id',index:'id',hidden:true},
            ],
            rowNum : 10,
            rowList:[10,20,30],
            pager : '#ajax_proback_list_page',
            sortname : 'createDate',
            sortorder : "desc",
            gridComplete:function(){
                var ids=$("#ajax_proback_table").jqGrid('getDataIDs');
                for(var i=0;i<ids.length;i++){
                    var cl=ids[i];
                    var rowData = $("#ajax_project_table").jqGrid("getRowData",cl);
                    var dr="<button class='btn btn-default' data-original-title='查看' onclick=\"fn_proback_read('"+cl+"');\"><i class='fa fa-eye'></i>查看</button>"+" ";

                    jQuery("#ajax_proback_table").jqGrid('setRowData',ids[i],{act:dr});
                }
                $(".ui-jqgrid-bdiv").css("overflow-x","hidden");
                jqGridStyle();
            },
            jsonReader: {
                root: "dataRows",
                page: "page",
                total: "total",
                records: "records",
                repeatitems : false
            },
            multiselect : false,
            rownumbers:true,
            gridview:true,
            shrinkToFit:true,
            viewrecords: true,
            autowidth: true,
            height:'auto',
            forceFit:true,
            loadComplete: function() {
            }
        });
        $(window).on('resize.jqGrid', function() {
            jQuery("#ajax_proback_table").jqGrid('setGridWidth', $("#ajax_proback_list_row").width());
        })

        jQuery("#ajax_proback_table").jqGrid('navGrid', "#ajax_proback_list_page", {
            edit : false,
            add : false,
            del : false,
            search:false
        });
    };

    function regularFormat(cellvalue, options, cell){
        var color = (cellvalue == "否") ? "btn-warning" :"btn-info";
        var r = (cellvalue == "否") ? "不正常" :"正常";
        return "<a href='javascript:void(0);' class='btn "+color+" btn-sm' >" + r + "</a>";
    }

    function fn_proback_read(id){
        loadURL("ajax-pro-back!read.action?viewType=2&keyId="+id,$('#s4'));
    }

    function fn_proback_edit(id){
        loadURL("ajax-pro-back!input.action?viewType=2&keyId="+id,$('#s4'));
    }
</script>